{% extends 'layout.html' %}
{% block title %}
    <title>部门列表</title>
{% endblock %}


{% block content %}
    <div style="margin-bottom: 15px">
        <a href="{% url 'dept_add' %}">
            <button type="button" class="btn btn-primary">新增</button>
        </a>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">部门列表</div>
        <div class="panel-body">
            <table class="table  table-striped">
                <tr>
                    <th>序号</th>
                    <th>ID</th>
                    <th>部门名称</th>
                    <th>部门地址</th>
                    <th>操作</th>
                </tr>
                {% for dept in dept_list %}
                    <tr>
                        <td>{{ forloop.counter }}</td>
                        <td>{{ dept.id }}</td>
                        <td>{{ dept.name }}</td>
                        <td>{{ dept.address }}</td>
                        <td>
                            {# /app08/dept/edit/{{ dept.id }}#}
                            <a href="{% url 'dept_edit' dept.id %}">
                                <button class="btn btn-primary">编辑</button>
                            </a>
                            <a href="{% url 'dept_delete' dept.id %}">
                                <button class="btn btn-danger">删除</button>
                            </a>
                        </td>
                    </tr>
                {% endfor %}
            </table>
         <span style="color: red">{{ request.session.error }}</span>
        </div>
    </div>
{% endblock %}